<!DOCTYPE html>





<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.4.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.4.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.4.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.4.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>


<script data-ad-client="ca-pub-8048531516491146" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

  <meta name="description" content="iOS 内存机制特点 有限的可用内存  iPhone 设备的 RAM 一直非常紧缺，iPhone 一代只有 128MB，直到 iPhone5 时达到了 1GB，并且在 iPhone7 plus 达到了 3GB。StackOverFlow 上提供了部分 iPhone 机型的可用内存数目。  低内存通知  在可用物理内存较少时，iOS 会给各应用发出低内存广播通知，如果此后可用内存仍然低于特定值，则会">
<meta name="keywords" content="Objective-C, iOS, Clean Page, Dirty Page, 虚拟内存">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS内存探秘">
<meta property="og:url" content="http://foogry.org/2017/02/13/2017-02-13-iosnei-cun-tan-mi/index.html">
<meta property="og:site_name" content="foogry的技术博客">
<meta property="og:description" content="iOS 内存机制特点 有限的可用内存  iPhone 设备的 RAM 一直非常紧缺，iPhone 一代只有 128MB，直到 iPhone5 时达到了 1GB，并且在 iPhone7 plus 达到了 3GB。StackOverFlow 上提供了部分 iPhone 机型的可用内存数目。  低内存通知  在可用物理内存较少时，iOS 会给各应用发出低内存广播通知，如果此后可用内存仍然低于特定值，则会">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-09-24T12:14:54.779Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="iOS内存探秘">
<meta name="twitter:description" content="iOS 内存机制特点 有限的可用内存  iPhone 设备的 RAM 一直非常紧缺，iPhone 一代只有 128MB，直到 iPhone5 时达到了 1GB，并且在 iPhone7 plus 达到了 3GB。StackOverFlow 上提供了部分 iPhone 机型的可用内存数目。  低内存通知  在可用物理内存较少时，iOS 会给各应用发出低内存广播通知，如果此后可用内存仍然低于特定值，则会">
  <link rel="canonical" href="http://foogry.org/2017/02/13/2017-02-13-iosnei-cun-tan-mi/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>iOS内存探秘 | foogry的技术博客</title>
  


  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?2944231de73b405a5da5c6b4097cfa0e";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
  <div class="container use-motion">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">foogry的技术博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <h1 class="site-subtitle" itemprop="description">Stay hungry,stay foolish.</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      <article itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block post">
    <link itemprop="mainEntityOfPage" href="http://foogry.org/2017/02/13/2017-02-13-iosnei-cun-tan-mi/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="foogry">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="foogry的技术博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">iOS内存探秘

          
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2017-02-13 16:38:45" itemprop="dateCreated datePublished" datetime="2017-02-13T16:38:45+08:00">2017-02-13</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-09-24 20:14:54" itemprop="dateModified" datetime="2019-09-24T20:14:54+08:00">2019-09-24</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/iOS/" itemprop="url" rel="index"><span itemprop="name">iOS</span></a></span>

                
                
              
            </span>
          

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
        
      
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2017/02/13/2017-02-13-iosnei-cun-tan-mi/#comments" itemprop="discussionUrl"><span class="post-comments-count valine-comment-count" data-xid="/2017/02/13/2017-02-13-iosnei-cun-tan-mi/" itemprop="commentCount"></span></a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="iOS-内存机制特点"><a href="#iOS-内存机制特点" class="headerlink" title="iOS 内存机制特点"></a>iOS 内存机制特点</h2><ul>
<li>有限的可用内存</li>
</ul>
<p>iPhone 设备的 RAM 一直非常紧缺，iPhone 一代只有 128MB，直到 iPhone5 时达到了 1GB，并且在 iPhone7 plus 达到了 3GB。<a href="http://stackoverflow.com/a/15200855/2293677" target="_blank" rel="noopener">StackOverFlow</a> 上提供了部分 iPhone 机型的可用内存数目。</p>
<ul>
<li>低内存通知</li>
</ul>
<p>在可用物理内存较少时，iOS 会给各应用发出低内存广播通知，如果此后可用内存仍然低于特定值，则会杀死优先级较低的进程。</p>
<ul>
<li>没有内存交换机制</li>
</ul>
<p>桌面操作系统可以在物理内存紧张的时候把暂时不用的物理内存置换到磁盘上，并在需要的时候再次加载到内存中。而 iOS 没有这种机制，原因是移动设备的闪存没有 PC 机那么大的硬盘，而且频繁的读写闪存会降低其寿命。目前 iOS 在内存不足时采用的方案是杀死优先级较低的进程。</p>
<ul>
<li>使用虚拟内存机制</li>
</ul>
<p>和大多数桌面操作系统一样，iOS 也使用虚拟内存机制。</p>
<a id="more"></a>

<h2 id="虚拟内存"><a href="#虚拟内存" class="headerlink" title="虚拟内存"></a>虚拟内存</h2><p>关于虚拟内存的原理和优缺点就不再累述，这里说下 iOS 虚拟内存机制中与众不同的地方。</p>
<h4 id="内存分页"><a href="#内存分页" class="headerlink" title="内存分页"></a>内存分页</h4><p>iOS 把虚拟内存每 4KB 划分成一个 Page，并不是所有的 Page 都会映射到物理内存中。每个 Page 有三种状态：</p>
<ul>
<li>Nonresident</li>
</ul>
<p>是否 Resident 是一个 Page 状态的重要标识，如果 Page 被映射到内存里了，这个 Page 就是 Resident 状态，否则就是 Nonresident 状态；</p>
<ul>
<li>Resident and clean</li>
</ul>
<p>基于 readonly 文件而被加载到内存中的 Page 称为 clean memory，比如：<code>系统 framework</code>、<code>可执行文件</code>、<code>通过 mmap 方式读取的文件</code> 等。这种 Page 由于是加载自不可变的文件，因此可以在物理内存紧张时被 iOS 自动 unload 出去，并且在需要的时候再重新从原来的文件加载到内存中。</p>
<ul>
<li>Resident and dirty</li>
</ul>
<p>凡是非 clean 的 Page 都是 dirty 的，它们的共同特点是 Page 在闪存中没有对应的文件，比如通过 alloc 在堆上创建的内存空间，已经解压的图片，database caches 等。dirty memory 不能被操作系统交换出去，只有在进程被杀死的时候才能被回收，因此在系统发生内存告警时，如果进程创建了大量的 dirty memory，那么将很有可能被 kill 掉。</p>
<h4 id="举例说明"><a href="#举例说明" class="headerlink" title="举例说明"></a>举例说明</h4><ul>
<li>Malloc 分配内存</li>
</ul>
<p>如前问所述，Malloc 的内存都是  Resident dirty 的，但事实上并非如此，比如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">char *p = valloc(2 * 4096);</span><br></pre></td></tr></table></figure>

<p>此时会在虚拟内存里申请两份 4096 字节的内存，但由于申请后没有使用，操作系统不会真正为刚申请的内存空间分配对应的物理内存空间，因此此时该内存空间处于 Nonresident 状态。如果对 p[0] 赋值：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">p[0] = 1;</span><br></pre></td></tr></table></figure>

<p>此时 P[0] 会被加载到物理内存上，由此变成 Resident dirty 状态，同理如果对 p[1] 赋值也一样。</p>
<ul>
<li>mmap 加载文件</li>
</ul>
<p>一个文件通过如果下述 mmap 方式加载：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">NSData *data = [NSData dataWithContentsOfMappedFile:file];char *p = (char *)[data bytes];</span><br></pre></td></tr></table></figure>

<p>此时文件由于未被使用，因此也仅仅是在虚拟内存中，操作系统并没有将其映射到物理里，因此所属 Page 的状态是 Nonresident。如果调用以下代码：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">printf(&quot;%c&quot;, p[0]);</span><br></pre></td></tr></table></figure>

<p>此时由于该文件的 p[0] 部分被使用，操作系统就会将 p[0] 部分加载到物理内存中，又因为 p 对应的存储区域是一个 mmap 方式加载的只读文件，因此 p[0] 对应的 Page 就是 Resident clean 的，而 p[1] 往后的部分由于仍然未被使用，Page 的状态不变。</p>
<h2 id="需要做什么"><a href="#需要做什么" class="headerlink" title="需要做什么"></a>需要做什么</h2><p>对于开发者来说，要想减少应用因内存告警被系统杀掉，应做到以下几点：</p>
<ul>
<li><p>该尽可能减少 dirty 内存的创建</p>
</li>
<li><p>要尽量保证 dirty 内存用完之后及时释放</p>
</li>
<li><p>及时处理系统内存告警通知，释放掉大量占用内存并且可重建的对象</p>
</li>
<li><p>在发生内存告警时，不再持续申请内存，更不能申请较大块的内存</p>
</li>
</ul>
<h2 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h2><ul>
<li><p><a href="https://en.wikipedia.org/wiki/List_of_iOS_devices" target="_blank" rel="noopener">List of iOS devices</a></p>
</li>
<li><p><a href="https://developer.apple.com/videos/play/wwdc2010/147/" target="_blank" rel="noopener">WWDC2010 Session 417:Advanced Performance Optimization on iPhone OS, Part 2</a></p>
</li>
<li><p><a href="https://developer.apple.com/videos/play/wwdc2012/242/" target="_blank" rel="noopener">WWDC2012 Session 242:iOS App Performance: Memory</a></p>
</li>
</ul>

    </div>

    
    
    
        
      
        <div id="reward-container">
  <div></div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
        
      
      <div style="display: inline-block">
        <img src="/images/weixinpay.jpg" alt="foogry 微信支付">
        <p>微信支付</p>
      </div>

  </div>
</div>

      
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>foogry</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://foogry.org/2017/02/13/2017-02-13-iosnei-cun-tan-mi/" title="iOS内存探秘">http://foogry.org/2017/02/13/2017-02-13-iosnei-cun-tan-mi/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-ND</a> 许可协议。转载请注明出处！</li>
</ul>
</div>

      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/iOS/" rel="tag"># iOS</a>
            
              <a href="/tags/Objective-C/" rel="tag"># Objective-C</a>
            
              <a href="/tags/Clean-Page/" rel="tag"># Clean Page</a>
            
              <a href="/tags/Dirty-Page/" rel="tag"># Dirty Page</a>
            
              <a href="/tags/虚拟内存/" rel="tag"># 虚拟内存</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2017/02/06/2017-02-06-wei-shi-yao-objective-c-dui-xiang-cun-chu-zai-dui-shang-er-bu-shi-zhan-shang/" rel="next" title="为什么 Objective-C 对象存储在堆上而不是栈上">
                  <i class="fa fa-chevron-left"></i> 为什么 Objective-C 对象存储在堆上而不是栈上
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2018/11/15/2018-11-15-try-catch-yuan-li-pou-xi/" rel="prev" title="try catch 原理剖析">
                  try catch 原理剖析 <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          
    
    <div class="comments" id="comments"></div>
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">
        
        
        
        
      

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#iOS-内存机制特点"><span class="nav-number">1.</span> <span class="nav-text">iOS 内存机制特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#虚拟内存"><span class="nav-number">2.</span> <span class="nav-text">虚拟内存</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#内存分页"><span class="nav-number">2.0.1.</span> <span class="nav-text">内存分页</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#举例说明"><span class="nav-number">2.0.2.</span> <span class="nav-text">举例说明</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#需要做什么"><span class="nav-number">3.</span> <span class="nav-text">需要做什么</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考文档"><span class="nav-number">4.</span> <span class="nav-text">参考文档</span></a></li></ol></div>
        
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">foogry</p>
  <div class="site-description" itemprop="description"></div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">22</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span>
        
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
        <span class="site-state-item-count">56</span>
        <span class="site-state-item-name">标签</span>
        
      </div>
    
  </nav>
  <div class="cc-license motion-element" itemprop="license">
    
  
    <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-nd.svg" alt="Creative Commons"></a>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">foogry</span>
</div>
  <div class="powered-by">Hosted by <a href="https://coding.net/pages" class="theme-link" rel="noopener" target="_blank">Coding Pages</a></div>
  <span class="post-meta-divider">|</span>
  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.9.0</div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.4.0</div>

        












        
      </div>
    </footer>
  </div>

  


  <script src="/lib/anime.min.js?v=3.1.0"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/js/utils.js?v=7.4.0"></script><script src="/js/motion.js?v=7.4.0"></script>
<script src="/js/schemes/pisces.js?v=7.4.0"></script>
<script src="/js/next-boot.js?v=7.4.0"></script>



  





















  

  

  


<script>
NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail,link';
  guest = guest.split(',').filter(item => {
    return GUEST.includes(item);
  });
  new Valine({
    el: '#comments',
    verify: false,
    notify: false,
    appId: 'vqsvFaA8FXndr4867HJvtJ7P-gzGzoHsz',
    appKey: '6L6ddsrLCJVMetc2W7CL9kkf',
    placeholder: 'Comment Here',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn',
    path: location.pathname
  });
}, window.Valine);
</script>

</body>
</html>
